home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
X User Tools
/
X User Tools (O'Reilly and Associates)(1994).ISO
/
sun4c
/
archive
/
tcltk.z
/
tcltk
/
man
/
catn
/
scrollbar.n
< prev
next >
Wrap
Text File
|
1994-09-20
|
10KB
|
265 lines
scrollbar(n) Tk Commands
_________________________________________________________________
NAME
scrollbar - Create and manipulate scrollbar widgets
SYNOPSIS
scrollbar _p_a_t_h_N_a_m_e ?_o_p_t_i_o_n_s?
STANDARD OPTIONS
activeForeground cursor relief |
background foreground repeatDelay
borderWidth orient repeatInterval
See the ``options'' manual entry for details on the standard
options.
WIDGET-SPECIFIC OPTIONS
Name: command
Class: Command
Command-Line Switch:-command
Specifies the prefix of a Tcl command to invoke to
change the view in the widget associated with the
scrollbar. When a user requests a view change by mani-
pulating the scrollbar, a Tcl command is invoked. The
actual command consists of this option followed by a
space and a number. The number indicates the logical
unit that should appear at the top of the associated
window.
Name: width
Class: Width
Command-Line Switch:-width
Specifies the desired narrow dimension of the scrollbar
window, not including 3-D border, if any. For vertical
scrollbars this will be the width and for horizontal
scrollbars this will be the height. The value may have |
any of the forms acceptable to Tk_GetPixels.
_________________________________________________________________
DESCRIPTION
The scrollbar command creates a new window (given by the
_p_a_t_h_N_a_m_e argument) and makes it into a scrollbar widget.
Additional options, described above, may be specified on the
command line or in the option database to configure aspects
of the scrollbar such as its colors, orientation, and
relief. The scrollbar command returns its _p_a_t_h_N_a_m_e argu-
ment. At the time this command is invoked, there must not
exist a window named _p_a_t_h_N_a_m_e, but _p_a_t_h_N_a_m_e's parent must
exist.
Tk 1
scrollbar(n) Tk Commands
A scrollbar is a widget that displays two arrows, one at
each end of the scrollbar, and a _s_l_i_d_e_r in the middle por-
tion of the scrollbar. A scrollbar is used to provide
information about what is visible in an _a_s_s_o_c_i_a_t_e_d _w_i_n_d_o_w
that displays an object of some sort (such as a file being
edited or a drawing). The position and size of the slider
indicate which portion of the object is visible in the asso-
ciated window. For example, if the slider in a vertical
scrollbar covers the top third of the area between the two
arrows, it means that the associated window displays the top
third of its object.
Scrollbars can be used to adjust the view in the associated
window by clicking or dragging with the mouse. See the
BINDINGS section below for details.
WIDGET COMMAND
The scrollbar command creates a new Tcl command whose name
is _p_a_t_h_N_a_m_e. This command may be used to invoke various
operations on the widget. It has the following general
form:
_p_a_t_h_N_a_m_e _o_p_t_i_o_n ?_a_r_g _a_r_g ...?
_O_p_t_i_o_n and the _a_r_gs determine the exact behavior of the com-
mand. The following commands are possible for scrollbar
widgets:
_p_a_t_h_N_a_m_e configure ?_o_p_t_i_o_n? ?_v_a_l_u_e _o_p_t_i_o_n _v_a_l_u_e ...?
Query or modify the configuration options of the
widget. If no _o_p_t_i_o_n is specified, returns a list
describing all of the available options for _p_a_t_h_N_a_m_e
(see Tk_ConfigureInfo for information on the format of
this list). If _o_p_t_i_o_n is specified with no _v_a_l_u_e, then
the command returns a list describing the one named
option (this list will be identical to the correspond-
ing sublist of the value returned if no _o_p_t_i_o_n is
specified). If one or more _o_p_t_i_o_n-_v_a_l_u_e pairs are
specified, then the command modifies the given widget
option(s) to have the given value(s); in this case the
command returns an empty string. _O_p_t_i_o_n may have any
of the values accepted by the scrollbar command.
_p_a_t_h_N_a_m_e get
Returns a Tcl list containing four decimal values,
which are the current _t_o_t_a_l_U_n_i_t_s, _w_i_d_n_o_w_U_n_i_t_s, _f_i_r_-
_s_t_U_n_i_t, and _l_a_s_t_U_n_i_t values for the scrollbar. These
are the values from the most recent set widget command
on the scrollbar.
_p_a_t_h_N_a_m_e set _t_o_t_a_l_U_n_i_t_s _w_i_n_d_o_w_U_n_i_t_s _f_i_r_s_t_U_n_i_t _l_a_s_t_U_n_i_t
This command is invoked to give the scrollbar
Tk 2
scrollbar(n) Tk Commands
information about the widget associated with the
scrollbar. _T_o_t_a_l_U_n_i_t_s is an integer value giving the
total size of the object being displayed in the associ-
ated widget. The meaning of one unit depends on the
associated widget; for example, in a text editor
widget units might correspond to lines of text. _W_i_n_-
_d_o_w_U_n_i_t_s indicates the total number of units that can
fit in the associated window at one time. _F_i_r_s_t_U_n_i_t
and _l_a_s_t_U_n_i_t give the indices of the first and last
units currently visible in the associated window (zero
corresponds to the first unit of the object). This
command should be invoked by the associated widget
whenever its object or window changes size and whenever
it changes the view in its window.
BINDINGS
The description below assumes a vertically-oriented
scrollbar. For a horizontally-oriented scrollbar replace
the words ``up'', ``down'', ``top'', and ``bottom'' with
``left'', ``right'', ``left'', and ``right'', respectively
A scrollbar widget is divided into five distinct areas.
From top to bottom, they are: the top arrow, the top gap
(the empty space between the arrow and the slider), the
slider, the bottom gap, and the bottom arrow. Pressing
mouse button 1 in each area has a different effect:
top arrow Causes the view in the associated window
to shift up by one unit (i.e. the object
appears to move down one unit in its
window). If the button is held down the
action will auto-repeat.
top gap Causes the view in the associated window
to shift up by one less than the number
of units in the window (i.e. the portion
of the object that used to appear at the
very top of the window will now appear
at the very bottom). If the button is
held down the action will auto-repeat.
slider Pressing button 1 in this area has no
immediate effect except to cause the
slider to appear sunken rather than
raised. However, if the mouse is moved
with the button down then the slider
will be dragged, adjusting the view as
the mouse is moved.
bottom gap Causes the view in the associated window
to shift down by one less than the
Tk 3
scrollbar(n) Tk Commands
number of units in the window (i.e. the
portion of the object that used to
appear at the very bottom of the window
will now appear at the very top). If
the button is held down the action will
auto-repeat.
bottom arrow Causes the view in the associated window
to shift down by one unit (i.e. the
object appears to move up one unit in
its window). If the button is held down
the action will auto-repeat.
Note: none of the actions described above has an immediate
impact on the position of the slider in the scrollbar. It
simply invokes the command specified in the command option
to notify the associated widget that a change in view is
desired. If the view is actually changed then the associ-
ated widget must invoke the scrollbar's set widget command
to change what is displayed in the scrollbar.
KEYWORDS
scrollbar, widget
Tk 4